package com.sjh.sjhliving.commodity.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.sjh.common.valid.EnumValidate;
import com.sjh.common.valid.SaveGroup;
import com.sjh.common.valid.UpdateGroup;
import com.sjh.common.valid.UpdateIsShowGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 家居品牌
 * 
 * @author sjh
 * @email sjh@gmail.com
 * @date 2023-05-06 20:32:36
 */
@Data
@TableName("commodity_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@NotNull(groups = {UpdateGroup.class, UpdateIsShowGroup.class}, message = "修改要求指定 id")
	@Null(groups = {SaveGroup.class}, message = "添加不能指定 id")
	@TableId
	private Long id;
	/**
	 * 品牌名
	 */
	@NotBlank(groups = {SaveGroup.class, UpdateGroup.class}, message = "品牌名不能为空")
	private String name;
	/**
	 * logo
	 */
	@NotBlank(groups = {SaveGroup.class}, message = "logo 不能为空")
	@URL(groups = {SaveGroup.class, UpdateGroup.class}, message = "logo 不是一个合法的 url")
	private String logo;
	/**
	 * 说明
	 */
	private String description;
	/**
	 * 显示
	 */
	@NotNull(groups = {SaveGroup.class, UpdateGroup.class})
	@EnumValidate(values = {0,1}, groups = {SaveGroup.class, UpdateGroup.class, UpdateIsShowGroup.class} )
	private Integer isshow;
	/**
	 * 检索首字母
	 */
	@NotBlank(groups = {SaveGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索字母必须是一个字母", groups = {SaveGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = {SaveGroup.class})
	@Min(value = 0, message = "排序值要求大于等于 0", groups = {SaveGroup.class, UpdateGroup.class})
	private Integer sort;

}
